import { rimraf } from 'rimraf';
import { globSync } from 'glob';

// 匹配所有 node_modules 文件夹
const files = globSync('packages/**/node_modules')

// 删除所有匹配的 node_modules
files.forEach((file) => {
  rimraf(file).then((deleted) => {
    if (!deleted) console.error(`Error deleting ${file}:`, err);
    else console.log(`Deleted ${file}`);
  });
});

// 删除其他文件
const filesToDelete = ['package-lock.json', 'pnpm-lock.yaml', 'node_modules'];
filesToDelete.forEach(file => {
  rimraf(file).then((deleted) => {
    if (!deleted) console.error(`Error deleting ${file}:`, err);
    else console.log(`Deleted ${file}`);
  });
});